<?php
if (!defined('IN_CONTEXT')) die('access violation error!');

if($isEmpty) die("Data is empty.");

$str = '';
foreach($templates as $v)
{
	if($v['tpl_status'] == 8)
	{
		$year = date('Y',$v['tpl_finish_time']);
		$month = intval(date('n',$v['tpl_finish_time']));
		$month--;
		$day = date('j',$v['tpl_finish_time']);
		$title = $v['tpl_name']."发布完成 设计人员:{$users[$v['tpl_designer_id']]} 测试人员:{$users[$v['tpl_tester_id']]}";
	}
	elseif($v['tpl_status'] == 6)
	{
		$year = date('Y',$v['tpl_allow_time']);
		$month = intval(date('n',$v['tpl_allow_time']));
		$month--;
		$day = date('j',$v['tpl_allow_time']);
		$title = $v['tpl_name']."测试通过 设计人员:{$users[$v['tpl_designer_id']]} 测试人员:{$users[$v['tpl_tester_id']]}";
	}
	
	$tpl_domain = $v['tpl_domain'];
	if(!(strpos($tpl_domain, 'http') === false))
	{
		$length = strlen($tpl_domain) - 7;
		$tpl_domain = substr($tpl_domain,-1 * $length,$length);
	}
	$tpl_domain = "http://".$tpl_domain;
	$str .= "{title:'$title',start:new Date($year, $month, $day),url:'$tpl_domain'},";
	$tpl_domain = '';
}
$str = substr($str,0,strlen($str)-1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta name="description" content="模板发布管理程序" />
<title>模板管理系统-我的日历</title>
<link rel="icon" href="./images/TplManagement.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./images/TplManagement.ico" type="image/x-icon" />
<link rel='stylesheet' type='text/css' href='./script/js/calendar/fullcalendar.css' />
<script type="text/javascript" src="./script/js/jquery-1.4.4.min.js"/></script>
<script type="text/javascript" src="./script/js/jquery-ui-1.8.8.custom.min.js"/></script>
<script type='text/javascript' src='./script/js/calendar/fullcalendar.min.js'></script>
<script type='text/javascript'>

	$(document).ready(function() {
	
		var date = new Date();
		var d = date.getDate();//17
		var m = date.getMonth();//0
		var y = date.getFullYear();//2010
		
		$('#calendar').fullCalendar({
			editable: false,
			events: [
				<?php echo $str;?>
			]
		});
		
	});

</script>
<style type='text/css'>

	body {
		margin-top: 40px;
		text-align: center;
		font-size: 14px;
		font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
		}

	#calendar {
		width: 900px;
		margin: 0 auto;
		}

</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>
